<?
$arr=get_client_refund_details($client);
if(!is_array($arr)) exit("fatal error(hiena) $client");
$client=$arr[0][client];
$reseller=$arr[0][reseller];
$comment=$arr[0][refund_comment];
//exit($arr[0][refund_type]);
if($arr[0][refund_type] == "3_days_refund") $d3="checked";
else if($arr[0][refund_type] == "domain_deposit") $dd="checked";
else if($arr[0][refund_type]  == "charge_back") $cb="checked";
else if($arr[0][refund_type]  == "normal") $nn="checked";

reset($arr);
foreach($arr  as $kk){
	$purchases.="<tr><td><input type='checkbox' name='sale_id[]' value='$kk[sale_id]' checked></td><td>$kk[type]</td><td>$kk[state]</td><td>$kk[order_number]</td></tr>";
}
$params[sid]=$sid;
$params[action]=$action;
$params[client]=$client;
$url="$baseURL/$webDIR/?".encode_params($params);
echo $errorMsg;
?>
<h3><?echo "$client is client of $reseller"?></h3>
<form action="<?echo $url?>" method="POST">
<TABLE class="bTable" cellspacing=0>
	<TR>
		<TH>Client</TH>
		<TH>Purchases</TH>
		<TH>Refund Comment</TH>
		<TH>Refund Type</TH>
		<TH>#</TH>
	</TR>
	<TR>
		<TD><?echo $client?></TD>
		<TD>
			<TABLE  border=0 cellspacing=0>
				<?echo $purchases?>
			</TABLE>
		</TD>
		<TD><TEXTAREA NAME='refund_comment' ROWS=3><?echo $comment?></TEXTAREA></TD>
		<TD>
			<table>
				<tr>
					<td>3 days </td>
					<td><input type=radio name='type' value='3_days_refund'  <?echo $d3?>></td>
				</tr>
				<tr>
					<td>domain deposit ok</td>
					<td><input type='radio' name='type' value='domain_deposit' <?echo $dd?>></td>
				</tr>
				<tr>
					<td>charge back</td>
					<td><input type='radio' name='type' value='charge_back'  <?echo $cb?>></td>
				</tr>
				<tr>
					<td>Normal</td>
					<td><input type='radio' name='type' value='normal'  <?echo $nn?>></td>
				</tr>
			</table>
		</TD>

		<TD><INPUT TYPE='SUBMIT' VALUE='Refund'></TD>
	</TR>
</TABLE>
</form>
